from base.authorize_base import *
from appium.webdriver.common.appiumby import *
from appium.webdriver import Remote
from base.base import *

class AuthorizePage(AuthorizeBase,BaseAssert):
    def privacy_agree_button_click(self,driver:Remote):
        privacy_agree_button_xpath=self.privacy_agree_button()
        return self.element_click_new(driver,By.XPATH,privacy_agree_button_xpath)

    def authorize_agree_button_click(self, driver: Remote):
        authorize_agree_button_xpath = self.authorize_agree_button()
        return self.element_click_new(driver,By.XPATH,authorize_agree_button_xpath)

    def ad_close_button_click(self, driver: Remote):
        ad_close_button_xpath = self.ad_close_button()
        return self.element_click_new(driver,By.XPATH,ad_close_button_xpath)

    def authorize_setup(self,driver):
        self.privacy_agree_button_click(driver)
        self.authorize_agree_button_click(driver)
        self.ad_close_button_click(driver)

    def authorize_assert(self, driver, img_name):
        """
        访问首页后判断图书标签
        :param driver:
        :param img_name:
        :return:
        """

        return self.find_img_in_source(driver, img_name)